const jwt = require("jsonwebtoken"); //webjsontoken
//生成token
const appSecret="8700582f377965dda7b2efb3e595dc72"
const appId="wxcad53895ba058944"
function getToken(openid) {
	// sign(加密数据，加密辅助，过期时间(单位/s))
	return jwt.sign({
		openid
	}, appSecret, {
		expiresIn: 60 * 60 * 24 * 30
	});
}
//解密token
function verifyToken(token) {
	return jwt.verify(token, appSecret, (err, decode) => {
		return decode
	})
}

module.exports = {
	getToken,
	verifyToken,
	appSecret,
	appId
}

